package com.netdisk.service.impl;
/**
 * 
 * @author chenlong
 */
import java.util.List;

import javax.annotation.Resource;

import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.stereotype.Component;

import com.netdisk.dao.impl.GroupsUsersDao;
import com.netdisk.entity.GroupsUsers;
import com.netdisk.entity.Log;
import com.netdisk.service.Service;

@Component("groupsUsersService ")
public class GroupsUsersService extends Service<GroupsUsers>{
	
	private GroupsUsersDao groupsUsersDao;
	
	public GroupsUsersDao getgroupsUsersDao() {
		return groupsUsersDao;
	}

	@Resource(name="groupsUsersDao")
	public void setgroupsUsersDao(GroupsUsersDao groupsUsersDao) {
		this.groupsUsersDao = groupsUsersDao;
	}

	@Override
	public void save(GroupsUsers obj, Log log) {
		groupsUsersDao.save(obj);
		logDao.save(log);
	}

	@Override
	public void update(GroupsUsers obj, Log log) {
		groupsUsersDao.update(obj);
		logDao.save(log);
		
	}

	@Override
	public void delete(GroupsUsers obj, Log log) {
		groupsUsersDao.delete(obj);
		logDao.save(log);
		
	}

	@Override
	public List<GroupsUsers> findAll() {
		return groupsUsersDao.findAll();
	}

	@Override
	public GroupsUsers findById(String id) {
		return groupsUsersDao.findById(id);
	}
	
	public GroupsUsers findById(long groupId, long userId) {
		return groupsUsersDao.findById(groupId, userId);
	}
	
	public List<GroupsUsers> findByGroupId(long groupId) {
		return groupsUsersDao.findByGroupId(groupId);
	}
	
	public List<GroupsUsers> findByUserId(long userId) {
		return groupsUsersDao.findByUserId(userId);
	}

	@Override
	public List<GroupsUsers> findByTop(int from, int max) {
		return groupsUsersDao.findByTop(from, max);
	}

}
